<?php
/*
 * This is to show inside folders....
 */
$foldmenu = true;

include '../../include/config.php';
$folder_path = 'http://' . $_SERVER['HTTP_HOST'] . '/salusme/storage/' . $_COOKIE['gid'] . '/folders/';
$content_path = $folder_path . $_GET['f'] . '/';
$allextensions = array('jpg', 'gif', 'jpeg', 'png', 'JPG', 'JPEG', 'PNG');
?>
<?php include '../head.php'; ?>
<title><?= $_GET['f'] ?> </title>
<head>
    <link rel="stylesheet" href="../../include/css/jquery.treeview.css" />	
    <script src="../../include/js/external/jquery.cookie.js" type="text/javascript"></script>
    <script src="../../include/js/jquery.treeview.js" type="text/javascript"></script>
    <link rel="stylesheet" href="../../include/css/prettyPhoto.css" type="text/css" media="screen" charset="utf-8" />
    <script src="../../include/js/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="../../include/js/demotree.js"></script>
    <style>
        .bb th, .bb td{
            border-bottom:  1px #000000 dotted !important ;
        }
    </style>
</head>
<body>
    <div id="wrapper" >

        <?php include '../header_profile.php'; ?>
        <?php include '../menu_left.php'; ?>
        <?php include 'folder_menu.php'; ?>


        <div id="mainContent" class="gallery clearfix">
            <hr>
            You are inside folder : <b><?= $_GET['f'] ?></b><br/>            
            Password of this folder : <b>
                <?php
                $p = mysql_query("select pwd from me_folders where sr='" . $_GET['sr'] . "' ") or die(mysql_error());
                while ($row2 = mysql_fetch_array($p)) {
                    echo $pwd = $row2['pwd'];
                }
                ?>
            </b> &nbsp;&nbsp; <a href="#" id="dlg3">update</a>
            <hr>
            <i>Your Uploaded Files</i>
            <table border="0" style="width: 100%; text-align: center; " >
                <tr class="bb">
                    <th style="width: 40px;">Sr.</th>
                    <th style="width: 400px;">File Name</th>
                    <th style="width: 160px;">Operation</th>
                </tr>
                <?php
                $files_list0 = mysql_query("select * from me_upload_files where uid='" . $_COOKIE['gid'] . "' and mdir='" . $_GET['f'] . "' ") or die(mysql_error());
                $i = 1;
                while ($flists = mysql_fetch_array($files_list0)) {
                    ?>                                    
                    <tr class="bb">
                        <td><?= $i ?></td>
                        <td>
                            <?php
                            if ($flists['attr'] == '') {
                                $filename = $flists['file_name'];
                            } else {
                                $filename = $flists['attr'];
                            }
                            $ext = pathinfo($flists['file_name'], PATHINFO_EXTENSION);
                            if (in_array($ext, $allextensions)) {
                                echo '<a href="' . $content_path . $flists['file_name'] . '" rel="prettyPhoto" >' . $filename . '</a>';
                            } else {
                                echo '<a href="' . $content_path . $flists['file_name'] . '" >' . $filename . '</a>';
                            }
                            ?>
                        </td>
                        <td>

                            <ul id="icons" class="ui-widget ui-helper-clearfix">                                        
    <!--                            <li class="ui-state-default ui-corner-all" title="Edit"><a href="?p=edit&uid=<?= $flists['uid'] ?>&sur=<?= $flists['sr'] ?>"><span class="ui-icon ui-icon-gear"></a></span></li>-->
                                <li class="ui-state-default ui-corner-all" title="Delete"><a href="../folder/folder_delete.php?uid=<?= $flists['uid'] ?>&sur=<?= $flists['sr'] ?>&dir=<?= $_GET['f'] ?>"><span class="ui-icon ui-icon-trash"></a></span></li>
                            </ul>

                        </td>
                    </tr>                
                    <?php
                    $i++;
                }
                ?>
            </table>                       
        </div>
        <div id="dialog3" title="Chage Password of folder : <?= $_GET['f'] ?> ">
            <form action="pass_chage.php" method="post" >
                <input type="password" name="pwd" placeholder="New Password" /><br/>
                <input type="hidden" name="sr" value="<?= $_GET['sr'] ?>"  />
                <input type="hidden" name="rp" value="<?= $_GET['f'] ?>" />
                <input type="submit" value="Chage Password" />
            </form>
        </div>

    </div><!-- wrapper over    -->
    <script type="text/javascript" charset="utf-8">
        $(document).ready(function(){
            $("area[rel^='prettyPhoto']").prettyPhoto();
    				
            $(".gallery:first a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'normal',theme:'light_square',slideshow:3000, autoplay_slideshow: false});
            $(".gallery:gt(0) a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'slow',slideshow:10000, hideflash: true});
    		
            $("#custom_content a[rel^='prettyPhoto']:first").prettyPhoto({
                custom_markup: '<div id="map_canvas" style="width:260px; height:265px"></div>',
                changepicturecallback: function(){ initialize(); }
            });

            $("#custom_content a[rel^='prettyPhoto']:last").prettyPhoto({
                custom_markup: '<div id="bsap_1259344" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div><div id="bsap_1237859" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6" style="height:260px"></div><div id="bsap_1251710" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div>',
                changepicturecallback: function(){ _bsap.exec(); }
            });
        });
    </script>
    <script src="../view/script.js"></script>
    <?php include '../menu_right.php'; ?>
</body>
</html>